<%-- 
    Document   : addCategory
    Created on : 13-08-2014, 22:22:49
    Author     : NGOCLINH-PC
--%>

<%@page import="java.util.ArrayList"%>
<%@page import="Data.Category"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<div class="tablemember">
   
    <%
        if (request.getParameter("EcateID") != null) {
            Category ct = new Category();
            int CateID = Integer.parseInt(request.getParameter("EcateID"));
            ArrayList<Category> a = ct.CselectById(CateID);
            if (a.size() > 0) {
                for (int i = 0; i < a.size(); i++) {
                    Category cate = a.get(i);
                     out.print("<h2 style='padding: 10px; color: #999;'>Update Category</h2>");
                         out.print("<hr />");
                    out.print("<form  action = '../CategoryPR' method = 'post'  name = 'formmember'> ");
                    out.print("<table width = '100%' border = '0' align = 'center' cellpadding = '14' cellspacing = '14'>");
                    out.print("<tr>");
                    out.print("<td width='10%'>Category ID</td>");
                    out.print("<td width='50%'><label for='txtcateid'></label>");
                    out.print("<input type='text' readonly name='txtcateid' id='txtcateid' value='" + cate.getCategoryID() + "' /></td>");
                    out.print("</tr>");

                    out.print("<tr>");
                    out.print("<td width='10%'>Category Name:</td>");
                    out.print("<td width='50%'><label for='txtdanhmuc'></label>");
                    out.print("<input type='text' name='txtdanhmuc' id='txtdanhmuc' value='" + cate.getCategoryName() + "'/></td>");
                    out.print("</tr>");

                    out.print("<tr>");
                    out.print("<td>Status:</td>");
                    if (cate.getCstatus() == 1) {
                        out.print("<td><input type='radio' name='radio1' id='rdtrangthai' value='1' checked />");
                        out.print(" Show ");
                        out.print("<input type='radio' name='radio1' id='rdtrangthai' value='0' />");
                        out.print("Hidden</td>");
                    } else {
                        out.print("<td><input type='radio' name='radio1' id='rdtrangthai' value='1' />");
                        out.print(" Show ");
                        out.print("<input type='radio' name='radio1' id='rdtrangthai' value='0' checked />");
                        out.print("Hidden</td>");
                    }
                    out.print("</tr>");
                    out.print("<tr >");
                    out.print("<td></td>");
                    out.print("<td colspan='2'><input type='submit' name='btnsubmit' id='btnsubmit' value='Submit' />");
                    out.print("</td>");
                    out.print("</tr>");
                    out.print("</table>");

                }
            }
        } else {
    %>
    <form action="../CategoryPR" method="post"  name="formmember">
        <h2 style="padding: 10px; color: #999;">Management Customer</h2>
                <hr />
        <table width="100%" border="0" align="center" cellpadding="14" cellspacing="14">
            <tr>
                <td width="10%">Category Name:</td>
                <td width="57%"><label for="txtdanhmuc"></label>
                    <input required type="text" name="txtdanhmuc" id="txtdanhmuc" value=""/></td>
            </tr>
            <tr>
                <td>Status:</td>
                <td><input type="radio" name="radio1" id="rdtrangthai" value="1" checked />
                    Show 
                    <input type="radio" name="radio1" id="rdtrangthai" value="0"  checked />
                    Hidden</td>
            </tr>
            <tr>
                <td></td>
                <td colspan="2"><input type="submit" name="btnsubmit" id="btnsubmit" value="Submit" />
                   
            </tr>
            <%}%>
        </table>

    </form>
</div>
